package com.qq.oauth;

import java.io.InputStream;
import java.util.Properties;

public class Config {
	public static String APP_ID = "";
	public static String APP_KEY = "";
	public static String OAUTH_CALLBACK = "http://www.domain.com/connect/qq/callback";
	public static String PROXY_HOST ="";
	public static int PROXY_PORT;
	public static String PROXY_USERNAME ="";
	public static String PROXY_PASSWORD ="";
	public static int TIME_DEVIATION ;
	

	static {
	    InputStream in = Config.class.getClassLoader().getResourceAsStream("connect.properties");
	    Properties properties = new Properties();
	    try {
			properties.load(in);
			APP_ID = properties.getProperty("APP_ID");
			APP_KEY = properties.getProperty("APP_KEY");
			OAUTH_CALLBACK = properties.getProperty("OAUTH_CALLBACK",OAUTH_CALLBACK);
			PROXY_HOST = properties.getProperty("PROXY_HOST");
			PROXY_PORT = Integer.valueOf("".equals(properties.getProperty("PROXY_PORT",""))?"0":properties.getProperty("PROXY_PORT"));
			PROXY_USERNAME = properties.getProperty("PROXY_USERNAME");
			PROXY_PASSWORD = properties.getProperty("PROXY_PASSWORD");
			TIME_DEVIATION = Integer.valueOf("".equals(properties.getProperty("TIME_DEVIATION",""))?"0":properties.getProperty("TIME_DEVIATION"));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private static Config config = new Config();
	private Config(){}
	public static Config getInstance(){
		return config;
	}
}
